//
//  MainModuleRouter.m
//  Pods
//
//  Created by 小码哥 on 2017/2/19.
//
//

#import "MainModuleRouter.h"
#import "MGJRouter.h"
#import "MainModuleAPI.h"

@implementation MainModuleRouter



+ (void)load {
    [MGJRouter registerURLPattern:@"miwei://getRootVC" toObjectHandler:^id(NSDictionary *routerParameters) {
        return [MainModuleAPI rootTabBarCcontroller];
    }];
    
    [MGJRouter registerURLPattern:@"miwei://addChildVC" toHandler:^(NSDictionary *routerParameters) {
        
        NSLog(@"%@", routerParameters);
        
        NSDictionary *params = routerParameters[MGJRouterParameterUserInfo];
        
        UIViewController *vc = params[@"vc"];
        NSString *nImg = params[@"nImg"];
        NSString *sImg = params[@"sImg"];
        NSString *title = params[@"title"];
        
        
        
        [MainModuleAPI addChildVC:vc normalImageName:nImg selectedImageName:sImg title:title];
        
        
        void(^block)(id result) = routerParameters[MGJRouterParameterCompletion];
        
        if (block != nil) {
            block(@"xxx");
        }
        
    }];
    
    
}



@end
